package health.lm.com.order.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import health.lm.com.component_base.widget.RatingBar;
import health.lm.com.order.R;
import health.lm.com.order.entity.OrderListEntity;

/**
 * 订单列表
 * @author Administrator
 */

public class OrderListAdapter extends BaseQuickAdapter<OrderListEntity.Order_list,BaseViewHolder> {
    public OrderListAdapter(@Nullable List<OrderListEntity.Order_list> data) {
        super(R.layout.item_order_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderListEntity.Order_list item) {
        helper.setText(R.id.tv_orders_id,String.format("订单号:%s",item.getOrderid()))
                .setText(R.id.tv_order_date,item.getCreate_time())
                .setText(R.id.tv_shop_name,item.getUnion_name())
                .setText(R.id.tv_pay_money,item.getMoney())
                .setText(R.id.tv_h_money,item.getCoin())
                .setText(R.id.tv_content,item.getContent())
                .setGone(R.id.tv_go_pj,false)
                .setGone(R.id.ll_content,true)
                .addOnClickListener(R.id.tv_go_pj);
        ((RatingBar)helper.getView(R.id.rb_start)).setStar(item.getStar());
    }
}
